using System;
using System.Linq;
using System.Text;
using DevExpress.Xpo;
using DevExpress.ExpressApp;
using System.ComponentModel;
using DevExpress.Data.Filtering;
using DevExpress.Persistent.Base;
using System.Collections.Generic;
using DevExpress.ExpressApp.Model;
using DevExpress.Persistent.BaseImpl;
using DevExpress.Persistent.Validation;
using DomainComponents.XCRM;
using DomainComponents.Common;
using DevExpress.ExpressApp.DC;

namespace XCRM.Module
{
    [DomainComponent]
    [ImageName("BO_Scheduler")]
    public interface ICRMActivity : IActivity, INotes
    {
    }

    [DomainComponent]
    [VisibleInReports]
    [ImageName("BO_Contact")]
    [NavigationItem(true, GroupName = "Sales")]
    [XafDisplayName("Contact")]
    public interface ICRMContact : IContact, IGenericEmail, ILeadTarget, IQuoteCustomer, IOrderCustomer, IOpportunityCustomer, INotes, IAddressable, IActivityTarget, IPhones
    {
    }

    [DomainComponent]
    [VisibleInReports]
    [ImageName("BO_Customer")]
    [XafDisplayName("Account")]
    [NavigationItem(true, GroupName = "Sales")]
    public interface ICRMAccount : IAccount, IGenericEmail, ILeadTarget, IQuoteCustomer, IOrderCustomer, IOpportunityCustomer, INotes, IAddressable, IActivityTarget, IPhones
    {
    }

    [DomainComponent]
    [VisibleInReports]
    [ImageName("BO_Opportunity")]
    [NavigationItem(true, GroupName = "Sales")]
    [XafDisplayName("Opportunity")]
    public interface ICRMOpportunity : IOpportunity, ILeadTarget, IQuoteOpportunity, IOrderOpportunity, INotes, IGenericAddressableSale, IActivityTarget, ISaleStageHistoryTarget
    {
    }

    [DomainComponent]
    [VisibleInReports]
    [ImageName("BO_Order")]
    [NavigationItem(true, GroupName = "Sales")]
    [XafDisplayName("Order")]
    public interface ICRMOrder : IOrder, IGenericAddressableSale, ILeadTarget, INotes, IActivityTarget, ISaleStageHistoryTarget
    {
    }


    [DomainComponent]
    [VisibleInReports]
    [ImageName("BO_Quote")]
    [NavigationItem(true, GroupName = "Sales")]
    [XafDisplayName("Quote")]
    public interface ICRMQuote : IQuote, IGenericAddressableSale, ILeadTarget, INotes, IActivityTarget, ISaleStageHistoryTarget
    {
    }


    [DomainComponent]
    [VisibleInReports]
    [ImageName("BO_Sale")]
    [NavigationItem(true, GroupName = "Sales")]
    [XafDisplayName("Invoice")]
    public interface ICRMInvoice : IInvoice, IGenericAddressableSale, IOpportunityTarget, IOrderTarget, IOpportunityInvoice, INotes, IActivityTarget, ISaleStageHistoryTarget
    {
    }

    [DomainComponent]
    [VisibleInReports]
    [ImageName("BO_Lead")]
    [NavigationItem(true, GroupName = "Sales")]
    [XafDisplayName("Lead")]
    public interface ICRMLead : ILead, IGenericEmail, INotes, IPhones, IActivityTarget, IAddressable, ISaleStageHistory
    {
    }

    [DomainComponent]
    [VisibleInReports]
    [ImageName("BO_Product")]
    [NavigationItem(true, GroupName = "Sales")]
    [XafDisplayName("Product")]
    public interface ICRMProduct : IProduct, INotes
    {
    }


    [DomainComponent]
    [VisibleInReports(false)]
    [XafDefaultProperty("DisplayName")]
    [ImageName("BO_User")]
    [XafDisplayName("User")]
    public interface IMyAppUser : IPersistentComplexSecurityUser, IPersistentAuthenticationStandardUser, IPerson { }


    [DomainLogic(typeof(IMyAppUser))]
    public class IMyAppUserLogic
    {
        public static string Get_DisplayName(IMyAppUser user)
        {
            return ((IPerson)user).FullName;
        }
    }


    //[DefaultClassOptions]
    ////[ImageName("BO_Contact")]
    ////[DefaultProperty("DisplayMemberNameForLookupEditorsOfThisType")]
    ////[DefaultListViewOptions(MasterDetailMode.ListViewOnly, false, NewItemRowPosition.None)]
    ////[Persistent("DatabaseTableName")]
    //// Specify more UI options using a declarative approach (http://documentation.devexpress.com/#Xaf/CustomDocument2701).
    //public class InterfacesExtensions : BaseObject
    //{ // Inherit from a different class to provide a custom primary key, concurrency and deletion behavior, etc. (http://documentation.devexpress.com/#Xaf/CustomDocument3146).
    //    public InterfacesExtensions(Session session)
    //        : base(session)
    //    {
    //    }
    //    public override void AfterConstruction()
    //    {
    //        base.AfterConstruction();
    //        // Place your initialization code here (http://documentation.devexpress.com/#Xaf/CustomDocument2834).
    //    }
    //    //private string _PersistentProperty;
    //    //[XafDisplayName("My display name"), ToolTip("My hint message")]
    //    //[ModelDefault("EditMask", "(000)-00"), Index(0), VisibleInListView(false)]
    //    //[Persistent("DatabaseColumnName"), RuleRequiredField(DefaultContexts.Save)]
    //    //public string PersistentProperty {
    //    //    get { return _PersistentProperty; }
    //    //    set { SetPropertyValue("PersistentProperty", ref _PersistentProperty, value); }
    //    //}

    //    //[Action(Caption = "My UI Action", ConfirmationMessage = "Are you sure?", ImageName = "Attention", AutoCommit = true)]
    //    //public void ActionMethod() {
    //    //    // Trigger a custom business logic for the current record in the UI (http://documentation.devexpress.com/#Xaf/CustomDocument2619).
    //    //    this.PersistentProperty = "Paid";
    //    //}
    //}
}
